Salesforce UX API icon

Salesforce UX API

(0 reviews)

TMF687 Stock Reservation and Cancel Reservation

1. Stock Reservation

This operation is to create stock reservation in b2bsoft.

URL
https://[localhost]:[port]/sfdc-ux/v1/{businessId}/reserveProductStock
url Param
nametypedescriptionrequired
businessIdstring2 letter ISO 3166 country code (TT, BB, JM, PA, etc.) identifying the business unit.Y
nametypedescriptionrequired
client_idstringThe client_id identifying the channel. Minimum characters: 5Y
client_secretstringPassword associated with the client_id. Minimum characters: 5Y
X-Correlation-IDstringIdentifier that correlates HTTP request between a client and server.
Any identification model (UUDI, checksum, etc.) can be used, as long as it is a unique value to differentiate a transaction.
Y
cURL request
curl --location 'https://nonprod.esb.cloud.lla.com/dev/sfdc-ux/sfdc-ux/v1/PR/reserveProductStock' \
--header 'Content-Type: application/json' \
--header 'client_id: 12345' \
--header 'client_secret: abcde' \
--header 'X-Correlation-ID: 2132652356986532' \
--data-raw '{
    "channel": [
        {
            "id": "SFDC-B2C"    //channel
        }
    ],
    "relatedParty": [
        {
            "id": "123345",  //userName
            "role": "Customer",
            "@referredType": "Customer"
        },
        {
            "id": "87654",   //dealerCode
            "role": "Dealer",
            "@referredType": "Organization"
        }
    ],
    "reserveProductStockItem": [
        {
            "id": "652810501996",    //sku
            "quantityRequested": {
                "amount": 2         //Quantity
            },
            "requestedProduct": {
                "product": [                    //array of serial numbers
                    {
                        "id": "45653476457871"  //SerialNumber
                    },
                    {
                        "id": "45653476457867" //SerialNumber
                    }
                ]
            }
        },
        {
            "id": "652810501996",  //sku
            "quantityRequested": {
                "amount": 2        //Quantity
            }
        }
    ]
}'
Definitions

Each of the request parameters is detailed.

nametypedescriptionrequired
channelarrayChannel beneficiary for this reservationY
channel.idstringChannel identifier, Ex: SFDC-B2CY
relatedPartyarrayA list of related party referencesY
relatedParty.idstringunique identifier. userName/dealerCodeY
relatedParty.rolestringRole played by the related party. Customer/DealerY
relatedParty.@referredTypestringThe actual type of the target instance when needed for disambiguation. Customer/OrganizationY
reserveProductStockItemarrayA list of product stock item reservationY
reserveProductStockItem.idstringUnique identifier of the ReserveProductStockItem. i.e skuY
reserveProductStockItem.quantityRequestedobjectAn amount in a given unitY
reserveProductStockItem.quantityRequested.amountnumberQuantity requested for reservationY
reserveProductStockItem.requestedProductobjectA product to be created defined by value or existing defined by referenceY*
reserveProductStockItem.requestedProduct.productarrayList of product serials to be reservedY*
reserveProductStockItem.requestedProduct.product.idstringSerial numberY*

Note : reserveProductStockItem.requestedProduct object is mandatory for serial products

Response

In this section all the possible data structures received by the client at the moment of responding the method are defined.

Possible response success

{
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "channel": [
        {
            "id": "SFDC-B2C"
        }
    ],
    "relatedParty": [
        {
            "id": "123345",
            "role": "Customer",
            "@referredType": "Customer"
        },
        {
            "id": "87654",
            "role": "Dealer",
            "@referredType": "Organization"
        }
    ],
    "reserveProductStockItem": [
        {
            "id": "652810501996",
            "quantityRequested": {
                "amount": 2
            },
            "requestedProduct": {
                "product": [
                    {
                        "id": "45653476457871"
                    },
                    {
                        "id": "45653476457867"
                    }
                ]
            }
        },
        {
            "id": "652810501996",
            "quantityRequested": {
                "amount": 2
            }
        }
    ]
}
Definitions

Each of the response parameters is detailed.

nametypedescriptionrequired
idstringDocument id from b2bsoftY
Request PayloadY

Possible response error

[ 400 ]

Bad Request - the request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

{
  "errors" : [{
      "code" : 400,
      "message" : "InvalidRequestParameter",
      "description" : "UserName '202506' was not found"
    }]
}
[ 401 ]

Unauthorized - The request has not been applied because it lacks valid authentication credentials for the target resource.

{
  "errors" : [{
      "code" : 401,
      "message" : "The user could not be authenticated for this request.",
      "description" : "The request has not been applied because it lacks valid authentication credentials for the target resource."
    }]
}
[ 404 ]

Not Found - server has not found a resource with that URI. This may be temporary and permanent condition. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

{
  "errors" : [{
      "code" : 404,
      "message" : "The server could not find the requested resource.",
      "description" : "The requested operation failed because a resource associated with the request could not be found."
    }]
}
[ 405 ]

Method Not Allowed - HTTP method not allowed for this resource. The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.

{
    "errors": [{
            "code": 405,
             "message": "APIKIT:METHOD_NOT_ALLOWED",
             "description": "HTTP Method DELETE not allowed for : /{businessId}/reserveProductStock"
        }]
}
[ 500 ]

Internal Server Error - server encountered an error processing request. This should not happen normally, but it is a generic error message, given when no more specific message is suitable.

{
  "errors" : [{
      "code" : 500,
      "message" : "Internal Server Error",
      "description": "The request failed due to an internal error"
    }]
}
[ 501 ]

Not implemented - indicates that the server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.

{
  "errors" : [{
      "code" : 501,
      "message" : "Not implemented",
      "description" : "Operation POST /reserveProductStock for Business Id: xxxx not implemented"
    }]
  }

=======================================================================================

2. Cancel Stock Reservation

This operation is to cancel stock reservation in b2bsoft.

URL
https://[localhost]:[port]/sfdc-ux/v1/{businessId}/productStock/{id}
url Param
nametypedescriptionrequired
businessIdstring2 letter ISO 3166 country code (TT, BB, JM, PA, etc.) identifying the business unit.Y
idstringDocument id to cancel reservationY
nametypedescriptionrequired
client_idstringThe client_id identifying the channel. Minimum characters: 5Y
client_secretstringPassword associated with the client_id. Minimum characters: 5Y
X-Correlation-IDstringIdentifier that correlates HTTP request between a client and server.
Any identification model (UUDI, checksum, etc.) can be used, as long as it is a unique value to differentiate a transaction.
Y
Query Param
nametypedescriptionrequired
realtedParty.idstringunique identifier of the related party. userName in this caseY
cURL request
curl --location --request DELETE 'https://nonprod.esb.cloud.lla.com/dev/sfdc-ux/sfdc-ux/v1/PR/productStock/3fa85f64-5717-4562-b3fc-2c963f66afa6?relatedParty.id=3534677' \
--header 'Content-Type: application/json' \
--header 'client_id: 12345' \
--header 'client_secret: abcde' \
--header 'X-Correlation-ID: 2132652356986532'
Response

204 - No Content

Possible response error

In this section all the possible data structures received by the client are defined and that must be considered as unsatisfactory when responding to the method.

[ 400 ]

Bad Request - the request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.

{
  "errors" : [{
      "code" : 400,
      "message" : "The request is invalid or not properly formed.",
      "description" : "Malformed request syntax, invalid request message framing, or deceptive request routing."
    }]
}
[ 401 ]

Unauthorized - The request has not been applied because it lacks valid authentication credentials for the target resource.

{
  "errors" : [{
      "code" : 401,
      "message" : "The user could not be authenticated for this request.",
      "description" : "The request has not been applied because it lacks valid authentication credentials for the target resource."
    }]
}
[ 404 ]

Not Found - server has not found a resource with that URI. This may be temporary and permanent condition. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

{
  "errors" : [{
      "code" : 404,
      "message" : "The server could not find the requested resource.",
      "description" : "The requested operation failed because a resource associated with the request could not be found."
    }]
}
[ 405 ]

Method Not Allowed - HTTP method not allowed for this resource. The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.

{
    "errors": [{
            "code": 405,
             "message": "APIKIT:METHOD_NOT_ALLOWED",
             "description": "HTTP Method POST not allowed for : /{businessId}/productStock/{id}"
        }]
}
[ 500 ]

Internal Server Error - server encountered an error processing request. This should not happen normally, but it is a generic error message, given when no more specific message is suitable.

{
  "errors" : [{
      "code" : 500,
      "message" : "Internal Server Error",
      "description": "The request failed due to an internal error"
    }]
}
[ 501 ]

Not implemented - indicates that the server does not support the functionality required to fulfill the request. This is the appropriate response when the server does not recognize the request method and is not capable of supporting it for any resource.

{
  "errors" : [{
      "code" : 501,
      "message" : "Not implemented",
      "description" : "Operation DELETE /productStock/{id} for Business Id: xxxx not implemented"
    }]
  }

Reviews